const mysql = require('mysql');
const config = require('../config/index');

const conn = mysql.createConnection(config.mysqlConfig);

const query = (sql,data) => {
    return new Promise((resolve,reject) => {
        conn.query(sql,data,(err,fileds) => {
            if(err){
               reject(err)
            }
            resolve(fileds)
        })
    })
}



module.exports = {
    conn,
    query,
}